import { takeEvery, put, delay, call } from 'redux-saga/effects'
import axios from 'axios'

function * takeAddCount() {
    // put ==> dispatch
    // yield delay(1000)
    // let data = yield axios.get("/getCount")
    let data = yield call(axios.get, "/getCount")
    yield put({ type: "ADD_COUNT", count: data.data.count })
}

function * takeDelCount() {
    console.log('我是要count进行减1了---异步')
}

function * rootSaga() {
    yield takeEvery('TAKE_ADD_COUNT', takeAddCount)
    yield takeEvery('TAKE_DEL_COUNT', takeDelCount)
}

export default rootSaga
